#include <DAVE3.h>			//Declarations from DAVE3 Code Generation (includes SFR declaration)
#include "N25Q032A.h"
#include "hybrid_ftl.h"

#define ARRAYLENGTH	4096

//Funktionen
/* Create buffer for transmit data */
uint16_t pSendData[ARRAYLENGTH];
/* Create buffer to read data */
uint16_t pReadData[ARRAYLENGTH];

int main(void)
{
	FTL001_Handler Handler;

	DAVE_Init();			// Initialization of DAVE Apps

	Handler.ReadID = N25Q032A_RDID;
	Handler.ProgramPage = N25Q032A_QuadWrite_PAGE;
	Handler.WriteEnable = N25Q032A_WriteEnable;
	Handler.ReadStatus = N25Q032A_STATUS_RD;
	Handler.ReadPage = N25Q032A_QuadRD_PAGE;
	Handler.SectorErase = N25Q032A_Sector_Erase;
	Handler.ConfigureStandard = N25Q032A_Std_Config;
	FTL001_RegisterHandler(&FTL001_Handle0 , &Handler);

	//Fee_format_device();

	Fee_init();

	pSendData[0] = 69;
	pSendData[1] = 96;
	pSendData[2] = 78;

	FTL001_StatusType w_status;
	FTL001_StatusType r_status;

	w_status = Fee_write(0x070200, &pSendData[0], ARRAYLENGTH);
	if (w_status != FTL001_NO_ERROR) {
		//ERROR!
	}
	r_status = Fee_read(0x070200, &pReadData[0], ARRAYLENGTH);
	if (r_status != FTL001_NO_ERROR) {
		//ERROR!
	}

	while(1) {
		asm("Nop");
		//DO NOTHING
	}

	return 0;
}
